﻿//Copyright (C) <2013>  <jonathan cleeve norton> All Rights Reserved 
//Contact jon.norton@fin-plus.co.uk website <http://www.fin-plus.co.uk/>
using System.Windows;

namespace FinPlusWPFControls
{
    //Note Prime use edit template columns use primative controls for data template
    public partial class FinPlusValueTriState : FinPlusControl
    {
        public override string Id { get { return GetValue(IdProperty).ToString(); } set { } }
        public override string[] States { get { return new string[] { "TestString", "ViewString", "IsValid" }; } }
        public override string TestString { get { return string.Format("{0}|{1}", IsEnabled, State.ToString()); } }

        public string ViewString { get { return string.Format("{0}|{1}", State.ToString()); } }
        public string FunctionName { get { return GetValue(FunctionNameProperty).ToString(); } set { } }
        public int State { get { return (int)GetValue(StateProperty); } set { SetValue(StateProperty, value); } }

        public static readonly DependencyProperty IdProperty = DependencyProperty.Register(Propertys.Id.ToString(), typeof(string), typeof(FinPlusValueTriState));
        public static readonly DependencyProperty FunctionNameProperty = DependencyProperty.Register(Propertys.FunctionName.ToString(), typeof(string), typeof(FinPlusValueTriState));
        public static readonly DependencyProperty StateProperty = DependencyProperty.Register(Propertys.State.ToString(), typeof(int), typeof(FinPlusValueTriState), new UIPropertyMetadata(Callback));

        private enum Propertys { Id, FunctionName, State }

        //construct
        public FinPlusValueTriState()
        {
            InitializeComponent();
            IsValid = true;
        }

        //public
        private void SetControl(DependencyPropertyChangedEventArgs a)
        {

        }

        //events
        private static void Callback(DependencyObject d, DependencyPropertyChangedEventArgs a) { ((FinPlusValueTriState)d).SetControl(a); ; }
    }
}